<HTML>
  <HEAD>
    <TITLE>threadpool Documentation</TITLE>
    <LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">

    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>

          <TD ALIGN="LEFT">
            <B>threadpool</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>

        </TR>
      </TABLE>
    </DIV>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
          <TD ALIGN="LEFT">
            <B>Reference</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="annotated.html">Class List</A> |
            <A CLASS="qindex" HREF="functions.html">Member Functions</A> |
            <A CLASS="qindex" HREF="namespacemembers.html">Typedefs</A> |
            <A CLASS="qindex" HREF="files.html">File List</A>
          </TD>
        </TR>
      </TABLE>
    </DIV>
<!-- Generated by Doxygen 1.4.6-NO -->
<h1>threadpool/pool_adaptors.hpp</h1><a href="a00030.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;boost/smart_ptr.hpp&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>threadpool
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="comment">// TODO convenience scheduling function</span>
<a name="l00035"></a>00035 <span class="comment"></span>    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool, <span class="keyword">typename</span> Runnable&gt;
<a name="l00036"></a><a class="code" href="a00036.html#98f421c235cc2031811a28e3aad3cc00">00036</a>     <span class="keywordtype">bool</span> <a class="code" href="a00036.html#a3a3ab4f72886455dbdf1f89da8cf2de">schedule</a>(Pool&amp; <a class="code" href="a00024.html">pool</a>, shared_ptr&lt;Runnable&gt; <span class="keyword">const</span> &amp; obj)
<a name="l00037"></a>00037     { 
<a name="l00038"></a>00038       <span class="keywordflow">return</span> pool-&gt;schedule(bind(&amp;Runnable::run, obj));
<a name="l00039"></a>00039     } 
<a name="l00040"></a>00040     
<a name="l00044"></a>00044     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool&gt;
<a name="l00045"></a>00045     <span class="keyword">typename</span> enable_if &lt; 
<a name="l00046"></a>00046       is_void&lt; typename result_of&lt; typename Pool::task_type() &gt;::type &gt;,
<a name="l00047"></a>00047       <span class="keywordtype">bool</span>
<a name="l00048"></a>00048     &gt;::type
<a name="l00049"></a><a class="code" href="a00036.html#934b0189105928cdb7d3ac7423820742">00049</a>     <a class="code" href="a00036.html#a3a3ab4f72886455dbdf1f89da8cf2de">schedule</a>(Pool&amp; <a class="code" href="a00024.html">pool</a>, <span class="keyword">typename</span> Pool::task_type <span class="keyword">const</span> &amp; task)
<a name="l00050"></a>00050     { 
<a name="l00051"></a>00051       <span class="keywordflow">return</span> pool.schedule(task);
<a name="l00052"></a>00052     } 
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 
<a name="l00055"></a>00055     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool&gt;
<a name="l00056"></a>00056     <span class="keyword">typename</span> enable_if &lt; 
<a name="l00057"></a>00057       is_void&lt; typename result_of&lt; typename Pool::task_type() &gt;::type &gt;,
<a name="l00058"></a>00058       <span class="keywordtype">bool</span>
<a name="l00059"></a>00059     &gt;::type
<a name="l00060"></a><a class="code" href="a00036.html#fb76f0c1ac6059ce7b0034d55fd9006d">00060</a>     <a class="code" href="a00036.html#a3a3ab4f72886455dbdf1f89da8cf2de">schedule</a>(shared_ptr&lt;Pool&gt; <span class="keyword">const</span> <a class="code" href="a00024.html">pool</a>, <span class="keyword">typename</span> Pool::task_type <span class="keyword">const</span> &amp; task)
<a name="l00061"></a>00061     { 
<a name="l00062"></a>00062       <span class="keywordflow">return</span> pool-&gt;schedule(task);
<a name="l00063"></a>00063     } 
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 } } <span class="comment">// namespace boost::threadpool</span>
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="preprocessor">#endif // THREADPOOL_POOL_ADAPTORS_HPP_INCLUDED</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00070"></a>00070 
</pre></div>    <BR>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
		  <TD CLASS="tiny" ALIGN="LEFT">Copyright &copy 2005-2007 Philipp Henkel</TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>
        </TR>       
      </TABLE>
    </DIV>  
  </BODY>
</HTML>
